//
//  HMMyNoteModel.m
//  HeartMark
//
//  Created by rimi on 2016/11/7.
//  Copyright © 2016年 黄华强. All rights reserved.
//

#import "HMMyNoteModel.h"

@implementation HMMyNoteModel

- (instancetype)initWithDict:(NSDictionary *)dict{
    if (self = [super init]) {
        [self setValuesForKeysWithDictionary:dict];
    }
    return self;
}
//获取myNoteModel数组的类方法
+ (NSMutableArray *)getMyNoteModelArray:(NSArray *)myNoteArray{
    
    NSMutableArray *myNoteModelArray = [NSMutableArray arrayWithCapacity:myNoteArray.count];
    for (NSDictionary *dict in myNoteArray) {
        HMMyNoteModel *model = [[HMMyNoteModel alloc] initWithDict:dict];
        model.monthModels = [MonthsModel getMonthModelArray:model.monthModels];
        [myNoteModelArray addObject:model];
    }
    
    return myNoteModelArray;
}

@end


#pragma mark - 月份模型
@implementation MonthsModel

- (instancetype)initWithDict:(NSDictionary *)dict{
    if (self = [super init]) {
        [self setValuesForKeysWithDictionary:dict];
    }
    return self;
}
//获取monthModel数组的类方法
+ (NSMutableArray *)getMonthModelArray:(NSArray *)monthArray{
    
    NSMutableArray *monthModelArray = [NSMutableArray arrayWithCapacity:monthArray.count];
    
    for (NSDictionary *dict in monthArray) {
        MonthsModel *model = [[MonthsModel alloc] initWithDict:dict];
        model.noteModels = [NoteModel getNoteModelArray:model.noteModels];
        [monthModelArray addObject:model];
    }
    
    return monthModelArray;
}

@end


#pragma mark - 笔记模型
@implementation NoteModel

- (instancetype)initWithDict:(NSDictionary *)dict{
    if (self = [super init]) {
        [self setValuesForKeysWithDictionary:dict];
    }
    return self;
}

//获取noteModel数组的类方法
+ (NSMutableArray *)getNoteModelArray:(NSArray *)noteArray{
    
    NSMutableArray *noteModelArray = [NSMutableArray arrayWithCapacity:noteArray.count];
    
    for (NSDictionary *dict in noteArray) {
        NoteModel *model = [[NoteModel alloc] initWithDict:dict];
        [noteModelArray addObject:model];
    }
    
    return noteModelArray;
}

@end
